/*
 * @Author: Qimu
 * @Date: 2020-04-17 08:36:48
 * @LastEditors: Qimu
 * @LastEditTime: 2020-04-22 15:32:24
 * @Description: file content
 * @FilePath: \koa2_api\module\schama\new.js
 */
const mongoose = require('../db/mongodb');
const moment = require('moment').locale('zh-cn');
let newsSchema = mongoose.Schema({
  title: {
    type: String,
    required: true,
    trim: true
  },
  content: {
    type: String,
    required: true,
    trim: true
  },
  createDate: {
    type: Date,
    default: Date.now
  },
  status: {
    type: Number,
    default: 1
  },
})

// newsSchema.path('createDate').get((v) => {
//   console.log('=============', v);
//   return moment(v).format('YYYY MMMM Do, h:mm:ss a');
// });

module.exports = New = mongoose.model('New', newsSchema, 'new');
